package org.appFactory.carleton;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringBufferInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.json.JSONException;
import org.json.JSONObject;

@SuppressWarnings("serial")
public class UserProfile extends CarletonBaseListener implements ServletResponseAware {

	private HttpServletResponse response = null;
	
	private String name;
		
	private String picURL;
		
	public String getName() {
		return name;
	}

	public String getPicURL() {
		return picURL;
	}

	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}
	
	public HttpServletResponse getServletResponse() {
		return this.response;
	}
		
	public String execute() {
		
		try {
			JSONObject userInfo = getFacebookService().getUserInfo();
			name = userInfo.get("name").toString();
			picURL = userInfo.get("picURL").toString();
			//events = getFacebookService().getEvents("40.7554902", "-73.9868152", 1000).toString();
			//System.out.println();
			return SUCCESS;

		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return SUCCESS ;
		}
	
	}
}
